<?php
function mydao_insert($sql){
	$mysql = new SaeMysql();
	$mysql->runSql($sql);
	if( $mysql->errno() != 0 ){
		die("Error:" . $mysql->errmsg() );
	}
	$id = $mysql->lastId();	
	$mysql->closeDb();		
	return $id;		
}

function mydao_runSql($sql){
	$mysql = new SaeMysql();
	$mysql->runSql($sql);
	if( $mysql->errno() != 0 ){
		die("Error:" . $mysql->errmsg() );
	}	
	$mysql->closeDb();
}

function mydao_getLine($sql){
	$mysql = new SaeMysql();
 	$data = $mysql->getLine($sql);
 	if($mysql->errno() != 0 ){
		die("Error:" . $mysql->errmsg() );
		return false;
	}	
	$mysql->closeDb();	
	return $data==null ? false : $data;
}

function mydao_getVar($sql){
	$mysql = new SaeMysql();
 	$data = $mysql->getVar($sql);
 	if($mysql->errno() != 0 ){
		die("Error:" . $mysql->errmsg() );
		return false;
	}	
	$mysql->closeDb();	
	return $data==null ? false : $data;
}

function mydao_getData($sql){
	$mysql = new SaeMysql();
 	$data = $mysql-> getData($sql);
 	if($mysql->errno() != 0 ){
		die("Error:" . $mysql->errmsg() );
	}	
	$mysql->closeDb();	
	return $data;
}
?>